using B.S.NewMedical.Api.Read.Application.Command.Order;
using B.S.NewMedical.Domain.Order;
using B.S.NewMedical.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using System.Threading;
using System.Threading.Tasks;

namespace B.S.NewMedical.Api.Read.Controllers.Order
{
    /// <summary>
    /// 挂号订单控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RegisterController : ControllerBase
    {
        private readonly IMediator mediator;

        public RegisterController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 获取挂号订单分页列表
        /// </summary>
        /// <param name="request">查询参数</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>挂号订单分页结果</returns>
        [HttpGet]
        public async Task<ApiPageing<RegisterModel>> GetRegisterPage([FromQuery] RegisterPageCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request, cancellationToken);
        }
    }
} 